import React from 'react'
// import qs from 'querystring'

const details = [
    {id:'01',content:'aaaaaaaaa'},
    {id:'02',content:'bbbbbbbbb'},
    {id:'03',content:'ccccccccc'}
]
class Detail extends React.Component {

    render() {
        console.log(this.props)
        // params 接收参数
        // const {id,title} = this.props.match.params

        // seatch 接收参数
        // const {search} = this.props.location
        // const {id,title} = qs.parse(search.slice(1))

        //state 接收参数
        const {id,title} = this.props.location.state
        const detailContent = details.find(item => item.id === id)
        return (
            <ul>
                <li>ID:{id}</li>
                <li>TITLE:{title}</li>
                <li>CONTENT:{detailContent.content}</li>
            </ul>
        )
    }
}

export default Detail